package com.df.ez_game.net;

import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler;
import io.netty.channel.EventLoopGroup;



import java.util.function.Consumer;

public interface Connector {
    EventLoopGroup getEventloopgroup();
    void addInHandler(ChannelHandler handler);
    void addOutHandler(ChannelHandler handler);
    void connect();
    void onConnected(Channel channel);
    void onError(Channel channel,Exception e);
    void sendMsg(byte[] data);
    
    /**
     * 设置连接状态监听器
     * @param listener 监听器回调函数，参数true表示连接成功，false表示连接失败
     */
    void setConnectListener(Consumer<Boolean> listener);
}
